<?php

namespace app\common;

enum OsType: int
{
    case OS_TYPE_ANDROID = 1;
    case OS_TYPE_IOS = 2;
    case OS_TYPE_WEB = 3;
    case OS_TYPE_H5 = 4;
    case OS_TYPE_MICRO_APP = 5;

    public function getStatus(): string
    {
        return match ($this) {
            self::OS_TYPE_ANDROID   => 'ANDROID',
            self::OS_TYPE_IOS       => 'IOS',
            self::OS_TYPE_WEB       => 'WEB',
            self::OS_TYPE_H5        => 'H5',
            self::OS_TYPE_MICRO_APP => '微信小程序',
        };
    }

    public static function values(): array
    {
        $notes = [];
        $array = array_column(self::cases(), 'value');
        foreach ($array as $value) {
            $notes[$value] = self::from($value)->getStatus();
        }
        return $notes;
    }
}